package Model
{
	import Controller.HeatingController;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;

	public class HeatingInfo extends EventDispatcher
	{
		private var _heatRecoverySystem:HeatRecoverySystem;
		private var _subsoilHeatExchanger:SubsoilHeatExchanger;
		private var _propertyChangedEvent:Event = new Event("changedProperty");
		private var heatingController:HeatingController;
		
		public function HeatingInfo()
		{
			this._heatRecoverySystem = new HeatRecoverySystem(0,"",0,"");
			this._subsoilHeatExchanger = new SubsoilHeatExchanger();
			this.heatingController = new HeatingController();
			
			this.addEventListener("changedProperty", handleChange);
		}

		public function get heatRecoverySystem():HeatRecoverySystem
		{
			return _heatRecoverySystem;
		}

		public function set heatRecoverySystem(value:HeatRecoverySystem):void
		{
			_heatRecoverySystem = value;
			dispatchEvent(this._propertyChangedEvent);
		}

		public function get subsoilHeatExchanger():SubsoilHeatExchanger
		{
			return _subsoilHeatExchanger;
		}

		public function set subsoilHeatExchanger(value:SubsoilHeatExchanger):void
		{
			_subsoilHeatExchanger = value;
			dispatchEvent(this._propertyChangedEvent);
		}

		protected function handleChange(event:Event):void
		{
			this.heatingController.updateHeatingOverviewStatus();
		}
		
	}
}